/**
 * 
 */
package com.luck.emp.common;

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;

/**
 * 生成供应商编号
 *
 */
public class SpWhOrderD extends StoredProcedure {
	private final static String STORE_PROCEDURE_NAME = "PKG_ORDER.P_ADD_WH_ORDER_D";
	
	/**
	 * 编译存储过程
	 * @param jdbcTemplate
	 */
	public SpWhOrderD(JdbcTemplate jdbcTemplate) {
		super(jdbcTemplate, STORE_PROCEDURE_NAME);
		declareParameter(new SqlParameter("PI_ORDER_CODE",Types.VARCHAR));
		declareParameter(new SqlParameter("PI_PRODUCT_CODE",Types.VARCHAR));
		declareParameter(new SqlParameter("PI_QTY",Types.INTEGER));//订单数量
		declareParameter(new SqlParameter("PI_PROC_QTY",Types.INTEGER));//过程数量
		declareParameter(new SqlParameter("PI_CONFIRM_QTY",Types.INTEGER));//确认数量
		declareParameter(new SqlParameter("PI_MODI_USER",Types.INTEGER));
		declareParameter(new SqlParameter("PI_MODI_DATE",Types.VARCHAR));
		compile();
	}
	
	/**
	 * 执行存储过程
	 * @param deptCode
	 * @return
	 */
	public void execute(String orderCode, String productCode, Long qty, Long procQty, Long confirmQty, Long modiUserId, String modiDate){
		 Map params = new HashMap();
		 params.put("PI_ORDER_CODE", orderCode);
		 params.put("PI_PRODUCT_CODE", productCode);
		 params.put("PI_QTY", qty);
		 params.put("PI_PROC_QTY", procQty);
		 params.put("PI_CONFIRM_QTY", confirmQty);
		 params.put("PI_MODI_USER", modiUserId);
		 params.put("PI_MODI_DATE", modiDate);
		 Map result = super.execute(params);
	 }
}
